Skip to content

Add Order Fulfillment Workflow and Workflow Saga demo apps#444

Merged
schananas merged 6 commits into
mainfrom
feat/workflow-demo-apps
May 11, 2026
Merged

Add Order Fulfillment Workflow and Workflow Saga demo apps#444
schananas merged 6 commits into
mainfrom
feat/workflow-demo-apps

Conversation

@schananas
Copy link
Copy Markdown
Contributor

Summary

Two new demo modules showing how to model multi-step business processes with the Axon Workflow Engine:

  • order-fulfillment-workflow — order → reserve stock → payment → ship → notify. Includes a live tracking UI: Leaflet map with animated truck movement, status pills, stats panel and activity log, all driven by SSE pushed from the projection's @EventHandlers. One-click buttons trigger single orders, bursts, and failure scenarios (out-of-stock, payment-timeout).
  • workflow-saga — saga-style order process showing wait/compensate patterns with the workflow DSL.

Test plan

  • mvn verify in order-fulfillment-workflow/ (Testcontainers IT spins up Axon Server)
  • mvn verify in workflow-saga/
  • Manual: mvn spring-boot:run in order-fulfillment-workflow/, open http://localhost:9090/, click "Stress test ×25" and "Mixed burst" — markers should animate end-to-end on the map

Comment thread order-fulfillment-workflow/pom.xml Outdated

<axon.version>5.1.0</axon.version>
<axoniq-framework.version>5.1.0</axoniq-framework.version>
<axon-workflow.version>1.0.0-SNAPSHOT</axon-workflow.version>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<axon-workflow.version>1.0.0-SNAPSHOT</axon-workflow.version>
<axon-workflow.version>0.1.0</axon-workflow.version>

Comment thread order-fulfillment-workflow/README.md Outdated
Comment thread order-fulfillment-workflow/README.md Outdated
- Java 21+
- Maven 3.9+
- Docker (for Axon Server)
- The Axon Workflow Engine (`io.axoniq.framework.workflow:*:1.0.0-SNAPSHOT`) installed in the local Maven repository
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The Axon Workflow Engine (`io.axoniq.framework.workflow:*:1.0.0-SNAPSHOT`) installed in the local Maven repository
- The Axoniq Workflow Engine (`io.axoniq.framework.workflow:*:1.0.0-SNAPSHOT`) installed in the local Maven repository

Comment thread workflow-saga/README.md Outdated
Comment thread workflow-saga/README.md Outdated
request payment + shipment in parallel, react to either of two payment outcomes, complete the
process — is expressed as plain imperative Java.

## What got simpler
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd word this section differently. It's fine to suggest things are better, but stating it like this is super on-the-nose and not in all cases entirely correct. It would come across as more honest if you also include what's better in a Saga compared to Workflows (from my pov, the massive single-method block is a massive no-no, for example).

Copy link
Copy Markdown
Collaborator

@smcvb smcvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All seems fair to me, but I'd want @zambrovski to give his two cents as well before merging.

Furthermore, although it's great this is here, we have not yet updates the code-samples build with AF5 at all. So, it might be a bit early to have these modules already.

@EventHandler
public void on(OrderPlaced event) {
var payload = new HashMap<String, Object>();
payload.put("type", "PLACED");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjectMapper can do it much faster by transforming a bean to Map<String, Object>.

Copy link
Copy Markdown
Contributor

@zambrovski zambrovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this has its own value to be presented here, independent of the visibility of examples we provide inside the module itself. This is a show case and it lives along side with other show cases.

Given the workflow-module is not public yet, I believe this one can be public before the access to the extension repository is changed to public.

So to me, if the proposed changes are applied, I see a value in publishing it here, in order to be able to show it to public already.

zambrovski and others added 2 commits May 5, 2026 17:33
Co-authored-by: Steven van Beelen <steven.vanbeelen@axoniq.io>
Co-authored-by: Steven van Beelen <steven.vanbeelen@axoniq.io>
@smcvb
Copy link
Copy Markdown
Collaborator

smcvb commented May 7, 2026

I believe this has its own value to be presented here, independent of the visibility of examples we provide inside the module itself. This is a show case and it lives along side with other show cases.

Given the workflow-module is not public yet, I believe this one can be public before the access to the extension repository is changed to public.

So to me, if the proposed changes are applied, I see a value in publishing it here, in order to be able to show it to public already.

Entirely fair point, @zambrovski. Let's go for this!

@schananas, would be good if the build actually is green as well, though. Would you mind spending some time on that too before we merge?

- Bump axon-workflow dependency from 1.0.0-SNAPSHOT to released 0.1.0
  in both demo poms; drop the central-portal-snapshots repository
  block now that the engine is on Maven Central. Fixes the red CI job.
- Rename "Axon Workflow Engine" to "Axoniq Workflow Engine" across the
  remaining poms, READMEs, and inline comments.
- Drop the now-obsolete "build the workflow engine locally first"
  snippet from order-fulfillment-workflow/README.md and update the
  Prerequisites version to 0.1.0.
- Rebalance the workflow-saga README's comparison section: rename
  "What got simpler" to "Comparison: @saga vs @workflow", add a
  framing paragraph that this is a trade-off, and add explicit
  "Where @workflow reads more naturally" and "Where @saga reads more
  naturally" subsections that acknowledge the single ~70-line
  execute() method and the value of per-handler decomposition.
- OrderEventStream: replace the manual HashMap.put chain in the
  OrderPlaced handler with ObjectMapper.convertValue(event, ...) plus
  the two extra "type"/"timestamp" entries. Uses the Jackson 3
  ObjectMapper (tools.jackson.databind) autoconfigured by Spring Boot 4.
@schananas
Copy link
Copy Markdown
Contributor Author

Review feedback addressed — see latest commit. CI should now resolve axon-workflow 0.1.0 from Maven Central.

@schananas schananas merged commit b91c5e2 into main May 11, 2026
4 checks passed
@schananas schananas deleted the feat/workflow-demo-apps branch May 11, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants